home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 September
/
EnigmA AMIGA RUN 10 (1996)(G.R. Edizioni)(IT)[!][issue 1996-09][EARSAN CD XI].iso
/
aweb
/
awebmailsend.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1996-03-24
|
6KB
|
173 lines
/* Inline mail send arexx script for Aweb (w/ Voodoo Launch Option!)
Version 1.0a
By Josef Faulkner (panther@gate.net) IRC: Josef
Description:
¯¯¯¯¯¯¯¯¯¯¯
This script is a mailto: plugin for Aweb. This script will be run in
response to mailto: URLs, and will allow you to either compose a message
inside Aweb's GUI and send it, with NO need for any SMTP mailers, or you
can Launch Voodoo and let it handle the job.
Features:
¯¯¯¯¯¯¯¯¯
o Does not need an external SMTP mail program, does network stuff itself
if you have the TCP: network device installed.
o Can launch Voodoo instead, and this script will pass it the screenname
and address, and fill in a default subject.
o Runs transparently. After you install, you don't even know it's there.
o Loads your signature into the <textarea> gadget.
Installation:
¯¯¯¯¯¯¯¯¯¯¯¯¯
1) Put this script in the same directory that the Aweb executable is in.
2) Set Aweb to the following settings:
----------------------------------------------
Network 3: External Programs
mailto:
Command: sys:rexxc/rx
Arguments: awebmailsend.rexx %s %s
----------------------------------------------
Network 1: General
[ X ] Allow Shell commands in Links (check on)
----------------------------------------------
3) Set your preferences for this script below:
*/
/* >--[ Settings - Customize for your system ]------------------------< */
SMTPHost = 'tequesta.gate.net' /* Name of your SMTP host */
VooDoo = 'N:Voodoo/Voodoo' /* Voodoo's location on your drive */
signature='DH2:net/.signature' /* Location of your .signature */
myemailaddress='' /* Set to your email address, or leave
blank, and it will look up your email
address from your ENV variables */
/* Main Script */
options results
if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then exit(20)
parse arg addr
address command 'delete T:awebmail.#?.html >NIL:'
fname='T:AwebMail.'time(S)'.html'
if (~exists('env:username'))|(~exists('env:hostname')) then do
call open(4,fname,w)
call writeln(4,'<html><head><title>Error</title></head><body>')
call writeln(4,'<h1>Error</h1>')
call writeln(4,'<b>You have not configured your USERNAME and HOSTNAME env variables.</b><br>')
call writeln(4,'Could not send mail. Please set these variables and re-try')
call close(4)
address AWEB.1 'OPEN file://localhost/'fname
exit
end
if left(addr,8)~='address=' then do
parse var addr addr' 'screen
if open(1,fname,w) then do
call writeln(1,'<html><head><title>')
call writeln(1,addr)
call writeln(1,'</title></head><body><h1>Mail to ')
call writeln(1,addr'</h1>')
call writeln(1,'<hr><form action="x-aweb:command/'voodoo' mail to 'addr' subject mailto:'addr' pubscreen 'screen'">')
call writeln(1,'<input type="submit" value="Use VooDoo!"><hr></form>')
call writeln(1,'<form action="x-aweb:rexx/awebmailsend.rexx">')
call writeln(1,'<tt>Mail to: <input size=60 name="address" value="'addr'"><br>')
call writeln(1,'Subject: <input size=75 name="subj" value="mailto:'addr'"><br>')
call writeln(1,'Mail text:</tt><hr>')
if exists(signature) then do
call writeln(1,'<textarea name="data" cols=75 rows=20>')
do n=1 to 4
call writeln(1,'')
end
call writeln(1,'--')
call open(2,signature,r)
do until eof(2)
call writeln(1,readln(2))
end
call close(2)
call writeln(1,'</textarea>')
end
else do
call writeln(1,'<textarea name="data" cols=75 rows=20></textarea>')
end
call writeln(1,'<hr><input type="submit" value="Send Mail"></form>')
call writeln(1,'</body></html>')
call close(1)
address AWEB.1 'OPEN file://localhost/'fname
end
else address command 'RequestChoice "MailToRexx" "Error" "Ok" >NIL:'
end
else do
if open(1,fname,w) then do
call open(99,'t:test',w)
call writeln(99,addr)
call close(99)
parse var addr 'address="'touser'" subj="'subj'" data="'otext
otext=left(otext,length(otext)-1)
otext=replace(otext,'*"','"')
otext=replace(otext,'*N',d2c(10))
if myemailaddress='' then do
call open(7,'env:username',r)
fromid=readln(7)
call close(7)
call open(7,'env:hostname',r)
fromhost=readln(7)
call close(7)
from=fromid'@'fromhost
end
else from=myemailaddress
data=replace(data,'.'d2c(13),'. 'd2c(13))
if exists('T:SentMail.txt') then call open(10,'T:SentMail.txt',a)
else call open(10,'T:SentMail.txt',w)
call writeln(10,'From: <'from'>')
call writeln(10,'To: 'touser)
call writeln(10,'Subject 'subj)
call writeln(10,'')
call writeln(10,otext)
call close(10)
if ~showlist(H,'TCP') then address command 'mount TCP: from amitcp:devs/inet-mountlist'
if ~showlist(H,'TCP') then address command 'mount TCP:'
if showlist(H,'TCP') then do
call open(8,'tcp:'smtphost'/25',w)
call writeln(8,'HELO')
call writeln(8,'MAIL FROM: '||from)
call writeln(8,'RCPT TO: '||touser)
call writeln(8,'DATA')
call writeln(8,'From: <'from'>')
call writeln(8,'To: 'touser)
call writeln(8,'Subject: 'subj)
call writeln(8,'')
call writeln(8,otext)
call writeln(8,'.')
call writeln(8,'QUIT')
call close(8)
end
else do
address command 'Requestchoice title="SMTPSend" BODY="Mail NOT sent. *nCouldn''t mount TCP:" GADGETS="Ok" >NIL:'
exit
end
otext=replace(otext,'<','<')
otext=replace(otext,'>','>')
call writeln(1,'<html><head><title>Mail to 'touser'</title></head><body>')
call writeln(1,'<h1>Mail sent to 'touser':</h1>')
call writeln(1,'<h2>'subj'</h2><pre>'otext)
call writeln(1,'</pre></body></html>')
call close(1)
address AWEB.1 'OPEN file://localhost/'fname
end
else address command 'Requestchoice title="SMTPSend" BODY="Mail Sent." GADGETS="Ok" >NIL:'
end
exit
REPLACE: procedure
parse arg a,b,c
d=index(a,b)
do while d~=0
a=insert(c,delstr(a,d,length(b)),d-1)
d=index(a,b)
end
return a